<script>
	var dodelete='__URL__/dodelete';
</script>
<!--table部分-->
<div class='col-md-12'>
	
	<!--上传控件-->
	<div class="panel panel-default">
	  <div class="panel-body">

	  	<div class='col-md-4'><button class='btn btn-info btn-lg' id='upld'>导入卡密数据</button></div>
	  	<div class='col-md-4'><a class='btn btn-success btn-lg' href='__ROOT__/somedata/mobandata.xlsx'>下载参考模板</a></div>
	  	<div class='col-md-4'><a class='btn btn-default btn-lg' href='__ROOT__/somedata/mobankongbaidata.xlsx'>下载空白模板</a></div>
	  	<div id='fenxijieguo'></div>
	    <!-- pt start -->
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/etc/huploadify/html5uploader.css"/>
	    <script type="text/javascript" src="__PUBLIC__/etc/huploadify/jquery.html5uploader.js"></script>
	    <script>var dogivetail='__APP__/Hupldf/dogivetail'</script>
	    <script type="text/javascript">
	    $(function(){
	        $('#upload').html5uploader({
	            fileTypeExts:'',//考虑到兼容性，就都可以传吧，但是需要在后期进行后缀名的判断
	            auto:true,
	            multi:false,
	            removeTimeout:0,
	            url:'__APP__/Hupldf/upload/folder/dataup',//
	            onUploadStart:function(){
	                //alert('开始上传');
	                $('#loading').trigger('click');
	                var timestamp = (new Date()).valueOf();
	            },
	            onInit:function(){
	                //alert('初始化');
	            },
	            onUploadComplete:function(file){
	                
	                $.post(
	                    '__URL__/fenxidaoru',
	                    {},
	                    function(data){
	                        $('#loading_cancel').trigger('click');
	                        var rslt=data['rslt'];
	                        if(rslt==1){
	                        	msg('导入成功！共导入'+data['tongji_success']+'条',1);
	                        	
	                        }else if(rslt==2){
	                        	msg('文件类型不匹配，仅支持xls和xlsx！');
	                        }else if(rslt==3){
	                        	msg('部分数据导入失败！其中成功导入'+data['tongji_success']+'条，失败数据及原因点击确定后出现！');
	                        	var arr_error=data['arr_error'];
	                        	var str="<br><br><br><br><b style='color:#f00'>已成功导入"+data['tongji_success']+"条数据。其中以下数据有问题，请检查！刷新后错误报告将消失，成功导入的数据将出现。</b><br><br><table class='table  table-striped  table-bordered table-hover'><tr><th>序号</th><th>账号</th><th>密码</th><th>类型</th><th>错误原因</th></tr>";
	                        	for(var i=0;i<arr_error.length;i++){
	                        		var dtupqyqqno=arr_error[i]['dtupqyqqno'];
	                        		var dtupqyqqpw=arr_error[i]['dtupqyqqpw'];
	                        		var typenm=arr_error[i]['typenm'];
	                        		var beizhu=arr_error[i]['beizhu'];
	                        		str=str+"<tr><td>"+i+"</td><td>"+dtupqyqqno+"</td><td>"+dtupqyqqpw+"</td><td>"+typenm+"</td><td>"+beizhu+"</td></tr>";
	                        	}
	                        	str=str+"</table>";
	                        	$('#fenxijieguo').html(str);
	                        }
	                        
	                    },
	                    'json'
	                );
	            }
	        });
	    });
	    </script>
	    <div id="upload" style='display:none'></div>
	  </div>
	</div>
	<script type="text/javascript">
	$(function(){
		$('#upld').click(function(){
			$('#uploadfilebtn').trigger('click');
		})
	})
	</script>

	<!--开始-->
	<table class='table table-hover table-striped table-bordered' id='NBtb'>
		<thead>
			<tr style="background-color: #337ab7;color:#fff">
				<th>序号</th>
				<volist name='thls' id='thv'>
					<th>{$thv}</th>
				</volist>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<volist name='mls' id='mv'>
				<tr>
					<td>{$pagestart+$i}</td>
					<?php foreach ($mv as $key => $value) {
						if(!in_array($key,$hide_fld)){
					?>
						<td>{$value}</td>
					<?php 
						}
					} ?>
					<td>
					<?php if($atho['athv']){ ?><a class='btn btn-success btn-sm' href="__URL__/view/id/<?php echo $mv[$lowmdmk.'id'] ?>">查看</a><?php } ?>
					<?php if($atho['athm']){ ?><a class='btn btn-warning btn-sm' href="__URL__/update/id/<?php echo $mv[$lowmdmk.'id'] ?>">修改</a><?php } ?>
					<?php if($atho['athd']){ ?><a class='btn btn-danger btn-sm' onclick="dlt(<?php echo $mv[$lowmdmk.'id'] ?>)" >删除</a><?php } ?>
					</td>
				</tr>
			</volist>
			
		</tbody>
	</table>
	
	<!--结束-->
	{$page}
	<br><br><?php if($atho['atha']){ ?><a class='btn btn-primary' href='__URL__/update/id/0'>添加</a><?php } ?>
</div>

<script type="text/javascript">

</script>
<script type="text/javascript">$("#NBtb thead").smartFloatTB();</script>
<script type="text/javascript">
function dlt(id){
	if(confirm("{$deleteconfirm}")){
		$.ajax({
            'type': 'GET',
            'url':dodelete,
            'async':false,  
            'contentType': 'application/json',
            'data': {'id':id},
            'dataType': 'json',
            'success': function(data) {
            	alert('删除成功！');
            	window.location.reload();
                console.log("success");
            },
            'error':function() {
                console.log("error");
            }
        });
	}
}
</script>
